<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<!DOCTYPE html>
<html>
<head>
<title>职位信息</title>

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<meta http-equiv="description" content="ajax方式">

<!-- 引入bootstrap -->
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/plugin/css/bootstrap.min.css">
<!-- 引入JQuery  bootstrap.js-->
<script
	src="${pageContext.request.contextPath}/plugin/js/jquery-3.2.1.min.js"></script>
<script
	src="${pageContext.request.contextPath}/plugin/js/bootstrap.min.js"></script>





</head>
<body>
	<!-- 顶栏 -->
	<jsp:include page="top.jsp"></jsp:include>
	<!-- 中间主体 -->
	<div class="container" id="content">
		<div class="row">
			<div class="col-md-10">
				<div class="panel panel-default">
					<div class="panel-heading">
						<div class="row">
							<h1 class="col-md-5">职位管理</h1>
							<form class="bs-example bs-example-form col-md-5" role="form"
								style="margin: 20px 0 10px 0;" action="queryPositionByName"
								id="form1" method="post">
								
								<div class="input-group">
									<input type="text" class="form-control" placeholder="请输入职位名"
										name="positionName"> <span class="input-group-addon btn"
										onclick="document.getElementById('form1').submit" id="sub">查询</span>
								</div>

							</form>
							<button class="btn btn-default col-md-2" style="margin-top: 20px"
								onClick="location='${pageContext.request.contextPath}/position/position/list'">
								新增职位信息 <span class="glyphicon glyphicon-plus"> </span>
							</button>

						</div>
					</div>

					<table class="table table-bordered" id="tableList">
						<thead>
							<tr>
								<th>序号</th>
								<th>职位名称</th>
								<th>职位描述</th>
								<th>父职位</th>
								<th>创建人名</th>
								<th>创建日期</th>
								<th>操作</th>

							</tr>
						</thead>
						<tbody id="tableTbody">

						</tbody>

					</table>
					<!--  <div class="panel-footer">
						<c:if test="${pagingVO != null}">
							<nav style="text-align: center">
								<ul class="pagination">
									<li><a href="sendmailList?page=${pagingVO.upPageNo}">&laquo;上一页</a></li>
									<li class="active"><a href="">${pagingVO.curentPageNo}</a></li>
									<c:if test="${pagingVO.curentPageNo+1 <= pagingVO.totalCount}">
										<li><a
											href="sendmailList?page=${pagingVO.curentPageNo+1}">${pagingVO.curentPageNo+1}</a></li>
									</c:if>
									<c:if test="${pagingVO.curentPageNo+2 <= pagingVO.totalCount}">
										<li><a
											href="sendmailList?page=${pagingVO.curentPageNo+2}">${pagingVO.curentPageNo+2}</a></li>
									</c:if>
									<c:if test="${pagingVO.curentPageNo+3 <= pagingVO.totalCount}">
										<li><a
											href="sendmailList?page=${pagingVO.curentPageNo+3}">${pagingVO.curentPageNo+3}</a></li>
									</c:if>
									<c:if test="${pagingVO.curentPageNo+4 <= pagingVO.totalCount}">
										<li><a
											href="sendmailList?page=${pagingVO.curentPageNo+4}">${pagingVO.curentPageNo+4}</a></li>
									</c:if>
									<li><a href="sendmailList?page=${pagingVO.totalCount}">最后一页&raquo;</a></li>
								</ul>
							</nav>
						</c:if>
					</div>-->

				</div>

			</div>
		</div>
	</div>
	<div class="container" id="footer">
		<div class="row">
			<div class="col-md-12"></div>
		</div>
	</div>

	<script type="text/javascript">
		$(function() {

			$
					.ajax({
						url : "${pageContext.request.contextPath}/position/positionList",
						type : "POST",

						dataType : "json",

						success : function(data) {
							$
									.each(
											data.data.positions,
											function(i, item) {
												
												var str = "";
												str = '<td>'
														+ item.positionId
														+ '</td>'
														+ '<td>'
														+ item.positionName
														+ '</td>'
														+ '<td>'
														+ item.positionDcription
														+ '</td>'
														+ '<td>'
														+ item.parentId
														+ '</td>'
														+ '<td>'
														+ item.positionCreateName
														+ '</td>'
														+ '<td>'
														+ item.positionCreateTime
														+ '</td>'
														+ '<td>'
														+ '<button class="btn btn-default btn-xs btn-info"'
														+'onClick=\"location=\'${pageContext.request.contextPath}/position/editPosition/'
														+item.positionId
														+'\'\"'
														+ '>'
														+ '编辑'
														+ '</button>'
														+ '</td>';
												$("#tableTbody").append(
														'<tr>' + str + '</tr>')
											});

						},
						error : function(data) {
							alert("显示菜单列表失败");

						}

					});

			return false;
		});
	</script>




</body>
<script type="text/javascript">
	function openAddWindows() {
		window
				.open(
						"${pageContext.request.contextPath}/position/add",
						"新增职位",
						"height=600, width=900, top=200, left=600,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")
	}
</script>
<!--  <script type="text/javascript">
		$("#nav li:nth-child(2)").addClass("active");

		function confirmDelete() {
			return confirm("确定删除该职位吗");
		}

		function confirmUpdate() {
			return confirm("确定修改该职位吗");
		}

        $("#sub").click(function () {
            $("#form1").submit();
        });
        <c:if test="${pagingVO != null}">
		if (${pagingVO.curentPageNo} == ${pagingVO.totalCount}) {
			$(".pagination li:last-child").addClass("disabled")
		};

		if (${pagingVO.curentPageNo} == ${1}) {
			$(".pagination li:nth-child(1)").addClass("disabled")
		};
    </c:if>
	</script> -->
</html>